# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-jsbeautifier
_pkgname=js-beautify
pkgver=1.13.4
pkgrel=1
pkgdesc='JavaScript unobfuscator and beautifier.'
groups=('blackarch' 'blackarch-webapp' 'blackarch-reversing')
arch=('any')
license=('MIT')
url='https://github.com/beautify-web/js-beautify'
depends=('python2' 'python2-six' 'python2-editorconfig')
makedepends=('python2-setuptools')
source=("$pkgname-$pkgver.tar.gz::https://github.com/beautify-web/$_pkgname/archive/v$pkgver.tar.gz")
sha512sums=('5a317f91bd93778dc7691412ff2b0f9d905c876c6de21a651251c5e013591cde117011b6f22190c2f1a21e5c15a1d61a6b05047acbae08dbd69c56612ec42076')

build() {
  cd "$_pkgname-$pkgver/python"

  python2 setup-js.py build
}

package() {
  cd "$_pkgname-$pkgver/python"

  python2 setup-js.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 ../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  mv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/bin/${_pkgname}2"
}

